package com.cnap.model.schedule.engine;

import com.cnap.model.schedule.PolicyParam;
import com.cnap.model.schedule.engine.alg.AlgDeployClusterInfo;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 算法引擎-部署策略计算响应
 *
 * @author xc
 **/
public class DeployPolicyCalcRes {
    // 真实策略
    private String actualPolicy;
    // 指标
    @JsonProperty(value = "indicator")
    private String indicators;
    // 策略
    private String policy;
    // 算法推荐
    private String recommendCloud;
    // 用户选择
    private String userChooseCloud;
    // algDeployClusterInfos
    private List<AlgDeployClusterInfo> algDeployClusterInfos;


    /**
     * get
     *
     * @return ActualPolicy
     */
    public String getActualPolicy() {
        return actualPolicy;
    }

    /**
     * set
     *
     * @param actualPolicy actualPolicy
     */
    public void setActualPolicy(String actualPolicy) {
        this.actualPolicy = actualPolicy;
    }

    /**
     * get
     *
     * @return Indicators
     */
    public String getIndicators() {
        return indicators;
    }

    /**
     * set
     *
     * @param indicators indicators
     */
    public void setIndicators(String indicators) {
        this.indicators = indicators;
    }

    /**
     * get
     *
     * @return Policy
     */
    public String getPolicy() {
        return policy;
    }

    /**
     * set
     *
     * @param policy policy
     */
    public void setPolicy(String policy) {
        this.policy = policy;
    }

    /**
     * get
     *
     * @return RecommendCloud
     */
    public String getRecommendCloud() {
        return recommendCloud;
    }

    /**
     * set
     *
     * @param recommendCloud recommendCloud
     */
    public void setRecommendCloud(String recommendCloud) {
        this.recommendCloud = recommendCloud;
    }

    /**
     * get
     *
     * @return UserChooseCloud
     */
    public String getUserChooseCloud() {
        return userChooseCloud;
    }

    /**
     * set
     *
     * @param userChooseCloud userChooseCloud
     */
    public void setUserChooseCloud(String userChooseCloud) {
        this.userChooseCloud = userChooseCloud;
    }

    /**
     * get
     *
     * @return AlgDeployClusterInfos
     */
    public List<AlgDeployClusterInfo> getAlgDeployClusterInfos() {
        return algDeployClusterInfos;
    }

    /**
     * set
     *
     * @param algDeployClusterInfos algDeployClusterInfos
     */
    public void setAlgDeployClusterInfos(List<AlgDeployClusterInfo> algDeployClusterInfos) {
        this.algDeployClusterInfos = algDeployClusterInfos;
    }

    /**
     * 转换成policyConfig
     *
     * @return 结果
     */
    public PolicyParam toPolicyParam() {
        PolicyParam config = new PolicyParam();
        config.setPolicy(this.policy);
        config.setActualPolicy(this.actualPolicy);
        Map<String, String> param = new HashMap<>(1);
        PolicyParamEnum paramEnum = PolicyParamEnum.getPolicyParamEnumByPolicyName(this.actualPolicy);
        param.put(paramEnum.getParamName(), this.indicators);
        config.setParam(param);
        return config;
    }

}
